/**
 * ApplicationServlet.java
 * Product:BaseLayer
 * Version:1.0
 * Copyright 2009 by DNE
 * All Rights Reserved.
 */
package com.dynamic.model.common.Listener;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.dynamic.model.util.redis.CacheManager;

//import site.common.MenuUtil;
//import site.common.MenuUtil2;
//import site.common.constant.MpfConstants;


/**
 * 应用启动时，初始化一些数据
 */
public class ApplicationListener implements ServletContextListener {
	private Log log=LogFactory.getLog(this.getClass());
	
	
	/*
	 * (non-Javadoc)
	 * 
	 * @seejavax.servlet.ServletContextListener#contextDestroyed(javax.servlet.
	 * ServletContextEvent)
	 */
	public void contextDestroyed(ServletContextEvent arg0) {
		// TODO Auto-generated method stub

	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * javax.servlet.ServletContextListener#contextInitialized(javax.servlet
	 * .ServletContextEvent)
	 */
	public void contextInitialized(ServletContextEvent event) {
		try {
			//加载LOG配置文件
//			InputStream inputStream = SystemEnv.getResourceAsStream("log4j.properties");
//			if(inputStream != null){
//				log.info("=======log4j文件目录：" + SystemEnv.getResourcePath("log4j.properties") + "=======");
//				PropertyConfigurator.configure(inputStream);
//			}
//			
//			log.info("========================================================");
//			log.info("=======当前系统环境为：" + SystemEnv.ENV + "=======");
//			log.info("========================================================");

			
			//后台菜单存储到context中
			CacheManager.getInstance().init();//初始化所有缓存使用的变量
			
		} catch (Exception e) {
			e.printStackTrace();
		}
	}	


	
}
